﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace TinySteamWrapper
{
    public class SteamProfile: INotifyPropertyChanged
    {

        public event PropertyChangedEventHandler PropertyChanged;

        protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }


        public SteamProfile()
        {
            Games = new ObservableCollection<SteamProfileGame>();
        }

        private long steamID;

        public long SteamID
        {
            get { return steamID; }
            set {
                if (steamID != value)
                {
                    steamID = value;
                    NotifyPropertyChanged("SteamID");
                } 
            }
        }

        private TinySteamWrapper.Steam.CommunityVisibilityState communityVisibilityState;

        public TinySteamWrapper.Steam.CommunityVisibilityState CommunityVisibilityState
        {
            get { return communityVisibilityState; }
            set {
                if (communityVisibilityState != value)
                {
                    communityVisibilityState = value;
                    NotifyPropertyChanged("CommunityVisibilityState");
                }
            }
        }

        private int profilestate;        

        public int ProfileState
        {
          get { return profilestate; }
          set {
              if (profilestate != value)
              {
                  profilestate = value;
                  NotifyPropertyChanged("ProfileState");
              }
          }
        }

        private String personaname;

        public String PersonaName
        {
            get { return personaname; }
            set
            {
                if (personaname != value)
                {
                    personaname = value;
                    NotifyPropertyChanged("PersonaName");
                }
            }
        }


        private DateTime lastlogoff;

        public DateTime LastLogOff
        {
            get { return lastlogoff; }
            set
            {
                if (lastlogoff != value)
                {
                    lastlogoff = value;
                    NotifyPropertyChanged("LastLogOff");
                }
            }
        }

        private String profileurl;

        public String ProfileUrl
        {
            get { return profileurl; }
            set
            {
                if (profileurl != value)
                {
                    profileurl = value;
                    NotifyPropertyChanged("ProfileUrl");
                }
            }
        }

        private String avatar;

        public String Avatar
        {
            get { return avatar; }
            set
            {
                if (avatar != value)
                {
                    avatar = value;
                    NotifyPropertyChanged("Avatar");
                }
            }
        }

        private String avatarmedium;

        public String AvatarMedium
        {
            get { return avatarmedium; }
            set
            {
                if (avatarmedium != value)
                {
                    avatarmedium = value;
                    NotifyPropertyChanged("AvatarMedium");
                }
            }
        }

        private String avatarfull;

        public String AvatarFull
        {
            get { return avatarfull; }
            set
            {
                if (avatarfull != value)
                {
                    avatarfull = value;
                    NotifyPropertyChanged("AvatarFull");
                }
            }
        }

        private TinySteamWrapper.Steam.PersonaState personastate;

        public TinySteamWrapper.Steam.PersonaState PersonaState
        {
            get { return personastate; }
            set
            {
                if (personastate != value)
                {
                    personastate = value;
                    NotifyPropertyChanged("PersonaState");
                }
            }
        }

        private String realname;

        public String RealName
        {
            get { return realname; }
            set
            {
                if (realname != value)
                {
                    realname = value;
                    NotifyPropertyChanged("RealName");
                }
            }
        }

        private long primaryclanid;

        public long PrimaryClanID
        {
            get { return primaryclanid; }
            set
            {
                if (primaryclanid != value)
                {
                    primaryclanid = value;
                    NotifyPropertyChanged("PrimaryClanID");
                }
            }
        }

        // Unix Timestamp
        private DateTime timecreated;

        public DateTime TimeCreated
        {
            get { return timecreated; }
            set
            {
                if (timecreated != value)
                {
                    timecreated = value;
                    NotifyPropertyChanged("TimeCreated");
                }
            }
        }

        private int personastateflags;

        public int PersonaStateFlags
        {
            get { return personastateflags; }
            set
            {
                if (personastateflags != value)
                {
                    personastateflags = value;
                    NotifyPropertyChanged("PersonaStateFlags");
                }
            }
        }

        private String loccountrycode;

        public String CountryCode
        {
            get { return loccountrycode; }
            set
            {
                if (loccountrycode != value)
                {
                    loccountrycode = value;
                    NotifyPropertyChanged("CountryCode");
                }
            }
        }

        private String locstatecode;

        public String StateCode
        {
            get { return locstatecode; }
            set
            {
                if (locstatecode != value)
                {
                    locstatecode = value;
                    NotifyPropertyChanged("StateCode");
                }
            }
        }

        private String loccityid;

        public String CityID
        {
            get { return loccityid; }
            set
            {
                if (loccityid != value)
                {
                    loccityid = value;
                    NotifyPropertyChanged("CityID");
                }
            }
        }

        #region Running Game

        private String gameserverip;

        public String CurrentGameServerIP
        {
            get { return gameserverip; }
            set
            {
                if (gameserverip != value)
                {
                    gameserverip = value;
                    NotifyPropertyChanged("CurrentGameServerIP");
                }
            }
        }

        private String gameextrainfo;

        public String CurrentGameExtraInfo
        {
            get { return gameextrainfo; }
            set
            {
                if (gameextrainfo != value)
                {
                    gameextrainfo = value;
                    NotifyPropertyChanged("CurrentGameExtraInfo");
                }
            }
        }

        private SteamApp game;

        public SteamApp CurrentGame
        {
            get { return game; }
            set
            {
                if (game != value)
                {
                    game = value;
                    NotifyPropertyChanged("CurrentGame");
                }
            }
        }

        private long gameserversteamid;

        public long CurrentGameServerSteamID
        {
            get { return gameserversteamid; }
            set
            {
                if (gameserversteamid != value)
                {
                    gameserversteamid = value;
                    NotifyPropertyChanged("CurrentGameServerSteamID");
                }
            }
        }

        private long lobbysteamid;

        public long CurrentLobbySteamID
        {
            get { return lobbysteamid; }
            set
            {
                if (lobbysteamid != value)
                {
                    lobbysteamid = value;
                    NotifyPropertyChanged("CurrentLobbySteamID");
                }
            }
        }

        public ObservableCollection<SteamProfileGame> Games { get; private set; }

        #endregion
    }
}
